<template>
  <div id="app">
    <div v-if="$route.name!=='404'">
      <sph-header></sph-header>
      <router-view></router-view>
      <sph-footer v-show="!$route.meta.hideFooter"></sph-footer>
    </div>
    <div v-else>
      <router-view></router-view>
    </div>
  </div>
</template>

<script>
import header from "components/header/header.vue"
import footer from "components/footer/footer.vue"
import {mapActions} from "vuex"
export default {
  name: 'App',
  components: {
    "sph-header":header,
    "sph-footer":footer
  },
  methods:{
    ...mapActions(["getCategoryList","getBanners","getFloors","autoLogin"]),
  },
  async created(){
    if(localStorage.getItem("sph_token")){
      await this.autoLogin()
    }
  },
  async mounted(){
    await this.getCategoryList();
    await this.getBanners()
    await this.getFloors()
    
  }
}
</script>

<style lang="less" scoped>

</style>
